package com.林子祺.CAT旅游系统.view.tour.buy;

import com.林子祺.CAT旅游系统.controller.contentmanagement.Charge;
import com.林子祺.CAT旅游系统.view.Menu;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ChargeMoney {

    public static void charge(){
        JFrame jf = new JFrame("请输入充值金额：");
        jf.setSize(200, 100);
        jf.setLocationRelativeTo(null);
        jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        JPanel panel = new JPanel(null);

        final JTextField textField = new JTextField(8);
        textField.setLocation(0,0);
        textField.setSize(100,30);
        textField.setFont(new Font(null, Font.PLAIN, 12));
        panel.add(textField);

        JButton btn = new JButton("提交");
        btn.setLocation(100,0);
        btn.setSize(70,30);
        btn.setFont(new Font(null, Font.PLAIN, 10));
        btn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                    String s = textField.getText();
                    double MyInt = Double.parseDouble(s);
                    Charge.charge(MyInt);
                    jf.dispose();
            }
        });
        panel.add(btn);

        jf.setContentPane(panel);
        jf.setVisible(true);

    }
}
